import request from '@/utils/request'
import echartsData from '../jsonData/echartsData.json'
const isProd = import.meta.env.MODE === 'production'

const parseParams = (params) => {
    return Object.keys(params)
        .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`)
        .join('&');
}

export const getChartData = (params, data) => {
    return isProd ? request({
        url: `http://21.47.224.120:19098/cygj/ngCurveToolController/singleDevComplexCurveFree?${parseParams(params)}`,
        method: 'post',
        data: data || {}
    }) : Promise.resolve(echartsData)
}